package com.ruoyi.food.dubbo;


import com.ruoyi.food.api.RemoteFoodService;
import com.ruoyi.food.api.model.FoodDiscountVo;
import com.ruoyi.food.service.FoodService;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * 远程菜品服务Impl
 *
 * @author Administrator
 * @date 2023/03/15
 */
@DubboService
@Service
@RequiredArgsConstructor
public class RemoteFoodServiceImpl implements RemoteFoodService {

    private final FoodService foodService;

    @Override
    public Map<Long, FoodDiscountVo> listFoodDetailByFoodIds(List<Long> foodIdList) {
        return foodService.listFoodDetailByFoodIds(foodIdList).stream().collect(Collectors.toMap(FoodDiscountVo::getFoodId, item -> item));
    }
}
